<? $number_fields = Db::num_fields($result) ?>
<table id="result_table">
	<thead>
		<tr><? for ($i=0; $meta = Db::fetch_field($result); $i++): ?>
			<th id="col_<?= $i ?>"><div><?= $meta->name ?>
				<input type="hidden" id="col_name_<?= $i ?>" value="<?= $meta->name ?>" />
				<input type="hidden" id="col_max_length_<?= $i ?>" value="<?= $meta->max_length ?>" />
				<input type="hidden" id="col_blob_<?= $i ?>" value="<?= $meta->blob ?>" />
				<input type="hidden" id="col_multiple_key_<?= $i ?>" value="<?= $meta->multiple_key ?>" />
				<input type="hidden" id="col_not_null_<?= $i ?>" value="<?= $meta->not_null ?>" />
				<input type="hidden" id="col_numeric_<?= $i ?>" value="<?= $meta->numeric ?>" />
				<input type="hidden" id="col_primary_key_<?= $i ?>" value="<?= $meta->primary_key ?>" />
				<input type="hidden" id="col_table_<?= $i ?>" value="<?= $meta->table ?>" />
				<input type="hidden" id="col_type_<?= $i ?>" value="<?= $meta->type ?>" />
				<input type="hidden" id="col_unique_key_<?= $i ?>" value="<?= $meta->unique_key ?>" />	
				<input type="hidden" id="col_unsigned_<?= $i ?>" value="<?= $meta->unsigned ?>" />	
				<input type="hidden" id="col_zerofill_<?= $i ?>" value="<?= $meta->zerofill ?>" />	
                </div>																												
			</th>
			<? endfor ?>
		</tr>
	</thead>
	<tbody>
<? for($row_index=0; $row = Db::fetch_row($result); $row_index++): ?>
	<tr id="row_<?= $row_index ?>" class="<?= ($row_index%2) ? '' : 'even' ?>">
		<? include '_row.php' ?>
	</tr>
<? endfor ?>
	</tbody>
</table>
<? for($i=0; $i < $number_fields ; $i++): ?>
	<div id="slide_<?= $i ?>" style="position:absolute; top: 0px; left: <?= (80* ($i+1))+$i ?>px; height:24px; border-left: 1px #BBBBBB solid; cursor:e-resize"></div>
<? endfor ?>
<script type="text/javascript">
var slide_start = 0;
<? for($i=0; $i < $number_fields ; $i++): ?>
		new Draggable('slide_<?= $i ?>',{constraint:'horizontal',
						onStart: function()
						{
							slide_start = $('slide_<?= $i ?>').getStripStyle('left');
						},
					  onEnd: function()
					  {
					  	 slide_fin = $('slide_<?= $i ?>').getStripStyle('left');
						 total =  Number($('col_<?= $i ?>').getStripStyle('width')) + Number(Number(slide_fin)-Number(slide_start));
						 resize_column(<?= $i ?>, total) 
					  }
					  });
<? endfor ?>	


</script>